package 字符串.middle;

/**
 *  制造字母异位词的最小步骤数
 * LWZ TODO : 2020/8/26
 * 题解难以看懂
 *
 */

import java.util.Date;

/**
 * @author Lw中
 * @date 2020/8/26 10:44
 */
public class YiSanSiQi {

    public static int minSteps(String s, String t) {
        int length = s.length();
        int[] counts = new int[26];
        for (int i = 0; i < length; i++) {
            char c1 = s.charAt(i), c2 = t.charAt(i);
            counts[c1 - 'a']++;
            counts[c2 - 'a']--;
        }
        int steps = 0;
        for (int i = 0; i < 26; i++) {
            if (counts[i] > 0) {
                steps += counts[i];
            }
        }
        return steps;
    }

    public static void main(String[] args) {

    }

}
